# -*- coding: utf-8 -*-
from datetime import timedelta
from utils.operators.cluster_for_spark_sql_operator import SparkSqlOperator
from jms_dm_door_pick.dwd.dwd_tab_door_pick_up_base_dt import jms_dwd__dwd_tab_door_pick_up_base_dt

jms_dm__dm_tab_door_pick_up_dm = SparkSqlOperator(
    task_id='jms_dm__dm_tab_door_pick_up_dm',
    email=['suning@jtexpress.com', 'yl_bigdata@yl-scm.com'],
    name='jms_dm__dm_tab_door_pick_up_dm_{{ execution_date | date_add(1) | cst_ds }}',
    sql='jms_dm_door_pick/dm/dm_tab_door_pick_up_dm/execute.sql',
    driver_cores=2 , 
    driver_memory='3G' , 
    executor_cores=2 , 
    executor_memory='1G' , 
    num_executors=2 , 
    pool_slots=1,
    conf={
        'spark.dynamicAllocation.maxExecutors'             : 2 , 
          'spark.sql.sources.partitionOverwriteMode': 'dynamic',
          'spark.dynamicallocation.enabled': 'true',
          'spark.dynamicAllocation.cachedExecutorIdleTimeout': '600',
          'spark.shuffle.service.enabled': 'true',
          'spark.sql.shuffle.partitions': '320',
          'spark.driver.maxResultSize': '1G',
          'spark.sql.broadcastTimeout': '360',
          'spark.yarn.executor.memoryOverhead': '11G',
          },
    hiveconf={'hive.exec.dynamic.partition': 'true',
              'hive.exec.dynamic.partition.mode': 'nonstrict',
              'hive.exec.max.dynamic.partitions.pernode': '200',
              'hive.exec.max.dynamic.partitions': '200',
              },
    yarn_queue='pro',
    retries=0,
    execution_timeout=timedelta(minutes=60),
)

jms_dm__dm_tab_door_pick_up_dm << [
    jms_dwd__dwd_tab_door_pick_up_base_dt
]
